/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
    overflow-x: hidden;
}

/* Main container - responsive height */
#main-container {
    width: 100%;
    height: 450px; /* Default iframe height */
    position: relative;
    overflow: hidden;
}

/* Full window mode detection */
@media (min-height: 500px) {
    body:not(.iframe-mode) #main-container {
        height: 90vh;
    }
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    text-align: center;
    max-width: 300px;
}

#main-container:hover .tooltip {
    opacity: 1;
}

/* Phase management */
.phase {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    overflow-y: auto;
}

.phase.active {
    opacity: 1;
    visibility: visible;
}

/* Character Selection Screen */
.interrogation-room {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.room-header {
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.room-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
    color: #ffd700;
}

.progress-indicator {
    font-size: 14px;
    color: #cccccc;
}

.character-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    flex: 1;
    margin-bottom: 15px;
}

.character-section h3 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 16px;
    color: #ffd700;
}

.character-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.character-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.character-card:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.character-card.interviewed {
    background: rgba(0, 255, 0, 0.2);
    border-color: #00ff00;
}

.character-card.interviewed::after {
    content: "✓";
    position: absolute;
    top: 5px;
    right: 5px;
    color: #00ff00;
    font-weight: bold;
}

.character-name {
    font-weight: bold;
    font-size: 14px;
    line-height: 1.2;
}

/* Notes section */
.notes-section {
    margin-bottom: 15px;
}

.notes-section h4 {
    margin-bottom: 8px;
    color: #ffd700;
    font-size: 14px;
}

#investigation-notes {
    width: 100%;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 8px;
    color: #ffffff;
    font-size: 12px;
    resize: none;
}

#investigation-notes::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Interview Screen */
.interview-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.character-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.character-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #1a1a2e;
}

.character-details {
    flex: 1;
}

.character-details h3 {
    margin-bottom: 5px;
    font-size: 18px;
}

.character-badge {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.dialogue-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.statement-box, .response-box {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
}

.statement-box h4, .response-box h4 {
    color: #ffd700;
    margin-bottom: 8px;
    font-size: 14px;
}

.questions-container h4 {
    color: #ffd700;
    margin-bottom: 10px;
    font-size: 14px;
}

#question-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.question-option {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 13px;
    line-height: 1.4;
}

.question-option:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ffd700;
    transform: translateX(5px);
}

.question-option.selected {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
}

/* Matching Screen */
.matching-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.matching-header {
    text-align: center;
    margin-bottom: 20px;
}

.matching-header h2 {
    color: #ffd700;
    margin-bottom: 8px;
    font-size: 18px;
}

.matching-header p {
    font-size: 14px;
    color: #cccccc;
}

.matching-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
    margin-bottom: 15px;
}

.column h3 {
    text-align: center;
    margin-bottom: 15px;
    color: #ffd700;
    font-size: 16px;
}

.matching-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.match-item {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    text-align: center;
    position: relative;
}

.match-item:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ffd700;
}

.match-item.selected {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
}

.match-item.matched {
    background: rgba(0, 255, 0, 0.2);
    border-color: #00ff00;
}

.matching-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.results-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.results-container h3 {
    color: #ffd700;
    margin-bottom: 15px;
}

/* Button styles */
.primary-btn, .secondary-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-btn {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #1a1a2e;
}

.primary-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #ffed4e, #ffd700);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.primary-btn:disabled {
    background: #666666;
    color: #999999;
    cursor: not-allowed;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ffd700;
}

/* Loading overlay */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 215, 0, 0.3);
    border-top: 4px solid #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .phase {
        padding: 10px;
    }
    
    .character-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .matching-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .character-info {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .matching-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .room-header h2 {
        font-size: 16px;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.5);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.7);
}